#include<iostream>
#include"functions.h"

using namespace std;

int main()
{
  int n = 5;
  double** A = new double*[n];
  for(int i = 0; i < n; i++)
    A[i] = new double[n]();
  A[0][0] = 10.0;
  A[1][1] = 9.0;
  A[2][2] = 7.0;
  A[3][3] = 12.0;
  A[4][4] = 15.0;
  for(int i = 1; i < n; i++)
    A[0][i] = A[i][0] = i;
  for(int i = 2; i < n; i++)
    A[1][i] = A[i][1] = pow(-1,i-1)*(i-1.0);
  A[2][3] = A[3][2] = 3.0;
  A[2][4] = A[4][2] = -5.0;
  A[3][4] = A[4][3] = -1.0;
  double* b = new double[n]();
  b[0] = 12.0;
  b[1] = -27.0;
  b[2] = 14.0;
  b[3] = -17.0;
  b[4] = 12.0;
  double* x = new double[n]();
  Jacobi_Iteration(A, b, x, pow(10, -10), n);
  for(int i = 0; i < n; i++)
    x[i] = 0.0;
  GS_Iteration(A, b, x, pow(10, -10), n);
  for(int i = 0; i < n; i++)
    x[i] = 0.0;
  ConjugateGradient(A, b, x, n);
  for(int i = 0; i < n; i++)
    delete [] A[i];
  delete [] A;
  delete [] b;
  delete [] x;
  return 0;
};
